import serverSelectUtils, { ServerSelectUtilsProps } from '@/components/amis/ServerSelectUtils/serverSelectUtils'
import { SelectControlSchema } from 'amis/lib/renderers/Form/Select'
import accountAdminApiConfig from '@/core/account/generated/apiconfig/accountAdminApiConfig'

class IamAccountIdSelectUtils {
	getSchema = (parmas?: Partial<ServerSelectUtilsProps>): SelectControlSchema => {
		const mergeProps = Object.assign(
			{
				label: '账户',
				name: 'id',
				labelField: 'id',
				searchField: 'id',
				valueField: 'id',
				detailApiConfig: accountAdminApiConfig.iamAccount.get,
				searchApiConfig: accountAdminApiConfig.iamAccount.search,
			} as ServerSelectUtilsProps,
			parmas,
		)
		return serverSelectUtils.getSchema(mergeProps)
	}
}

export default new IamAccountIdSelectUtils()
